<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <h:head>
        <title>Delivery Order</title>
    </h:head>
    <f:view beforePhase="#{UserDisplayManagedBean.doDisplay}">
        <f:view beforePhase="#{DeliveryOrderManagedBean.initView2}">
            <h:body>
                <h:form prependId="false">
                    <p:growl id="msgs" showDetail="true"/>
                    <p:growl id="notif" showDetail="true"/>
                    <div id="top" class="top">
                        <h:graphicImage value="/image/newHeader.jpg"/>
                    </div>
                    <div id="content">
                        <p:poll interval="5"   
                                actionListener="#{MessageManagedBean.checkNewMessage}" immediate="true" update="notif" />
                        <table >
                            <tr><td>
                                    <p:toolbar style="background-color:darkred;font-size:70%;height:25px;width:100%"> 
                                        <p:toolbarGroup align="right">
                                            <p:button title="Home" image="ui-icon-home" outcome ="InventoryDeptWorkspace"/>                                  
                                            <p:button title="Notes" image="ui-icon-note" outcome="tasks"/>                                    
                                            <p:button title="Mail" outcome="messages" image="ui-icon-mail-closed"/>                                   
                                            <p:button title="Edit Preferences" image="ui-icon-gear"/>                                   
                                            <p:button title="Help" image="ui-icon-help"/>
                                            <p:commandButton title="Log Out" immediate="true" type="submit" image="ui-icon-close" actionListener="#{UserManagedBean.doLogout}"/> 
                                        </p:toolbarGroup>
                                    </p:toolbar></td>
                                <td>
                                    <h:graphicImage value="warehouse.gif" style="width:40px;height:40px" />
                                    <h:outputText value="       "/>
                                    <h:outputText value="Delivery Orders" style="font-size: 20px;font-weight: bolder ;font-family: Tahoma;text-align:left;color: darkblue"/>

                                </td>
                            </tr>
                            <tr>

                                <td style="vertical-align:top">
                                    <p:menu style="width:200px;font-size: 12px;font-family: Tahoma;border-style: ridge">  
                                        <p:submenu label="Inventories" > 
                                            <p:menuitem value="New Product" url="http://localhost:8080/MerlionERP-war/SCM/addProduct.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>  
                                            <p:menuitem value="View All Products" url="http://localhost:8080/MerlionERP-war/SCM/products.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>  
                                            <p:menuitem value="New Material" url="http://localhost:8080/MerlionERP-war/SCM/addMaterial.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>                                      
                                            <p:menuitem value="View All Materials" url="http://localhost:8080/MerlionERP-war/SCM/materials.xhtml" ajax="false" icon="ui-icon ui-icon-tag" />
                                            <p:menuitem value="View Unhoused Inventories" url="http://localhost:8080/MerlionERP-war/SCM/unhousedInventories.xhtml" ajax="false" icon="ui-icon ui-icon-tag" />
                                            <p:menuitem value="View Inventory Movements" url="http://localhost:8080/MerlionERP-war/SCM/inventoryMovements.xhtml" ajax="false" icon="ui-icon ui-icon-tag" />

                                        </p:submenu>
                                        <p:submenu label="Warehouses" >
                                            <p:menuitem value="New Warehouse" url="http://localhost:8080/MerlionERP-war/SCM/addWarehouse.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>        
                                            <p:menuitem value= "View All Warehouses" url="http://localhost:8080/MerlionERP-war/SCM/warehouses.xhtml" ajax="false" icon="ui-icon ui-icon-tag" />
                                        </p:submenu>
                                        <p:submenu label="Shipments and Orders">
                                            <p:menuitem value="Delivery Orders" url="http://localhost:8080/MerlionERP-war/SCM/deliveryOrders.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>
                                            <p:menuitem value="Picking Orders" url="http://localhost:8080/MerlionERP-war/SCM/pickingOrders.xhtml" ajax="false" icon="ui-icon ui-icon-tag"/>            
                                        </p:submenu>
                                    </p:menu>
                                    <p:calendar mode="inline" style="font-size:11px;font-family:Tahoma"/>
                                </td>

                                <td style="vertical-align:top">

                                    <p:toolbar style="background-color:  #d9bb73;font-size: 70%;width:99.5%"> 
                                        <p:toolbarGroup align="left">  
                                           <p:commandButton value="Delete" title="Delete" image="ui-icon ui-icon-trash" oncomplete="deleteDialog.show()"/>                                   

                                        </p:toolbarGroup>  
                                    </p:toolbar> 

                                    <p:dataTable id="panel" 
                                                 var="deliveryOrders" value="#{DeliveryOrderManagedBean.deliveryOrderList}"                       
                                                 paginator="true" rows="5"  
                                                 paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                                 rowEditListener="#{DeliveryOrderManagedBean.onEditRow}"
                                                 rowsPerPageTemplate="5,10,15"  style="font-size:60%;width:100%"
                                                 selection="#{DeliveryOrderManagedBean.selectedDeliveryOrders}"
                                                 emptyMessage="No data found with given criteria" widgetVar="deliveryOrderTable">  

                                        <f:facet name="header">                           
                                            <p:outputPanel style="text-align:right"  >
                                                <h:outputText value="Search all fields:" style="margin-left:840px" />  
                                                <p:inputText id="globalFilter" onkeyup="deliveryOrderTable.filter()" style="right:-100px;width:150px" />  
                                            </p:outputPanel>
                                        </f:facet> 

                                        <p:column selectionMode="multiple"/> <!-- style="border-left-color:transparent;border-right-color:transparent"/>-->


                                        <p:column headerText="View" style="width:20px;border-right-color:transparent">  
                                            <p:rowToggler />  
                                        </p:column>


                                        <p:column headerText="Edit" style="width:20px;border-left-color:transparent;border-right-color:transparent">    
                                            <p:rowEditor/>
                                        </p:column>


                                        <p:column headerText="Del." style="width: 16px;border-left-color:transparent">
                                            <!--DELETE-->
                                            <p:commandButton title="Delete" image="ui-icon ui-icon-trash" ajax="true" immediate="true"
                                                             update="panel" oncomplete="customerdialog.show()">
                                                <f:setPropertyActionListener target="#{DeliveryOrderManagedBean.selectedDeliveryOrder}"
                                                                             value="#{deliveryOrders}"/>
                                            </p:commandButton>
                                        </p:column>


                                        <!--SALES ORDER ID-->
                                        <p:column sortBy="#{deliveryOrders.id}" filterBy="#{deliveryOrders.id}" 
                                                  filterMatchMode="contains"  >
                                            <!--style="border-left-color:transparent;border-right-color:transparent">-->
                                            <f:facet name="header">
                                                <h:outputText value="ID"/>
                                            </f:facet>
                                            <h:outputText value="#{deliveryOrders.id}"/>
                                        </p:column>

                                        <!--DATE ISSUED-->
                                        <p:column headerText="Date Issued" sortBy="#{deliveryOrders.dateIssued}" 
                                                  filterBy="#{deliveryOrders.dateIssued}" filterMatchMode="contains">
                                            <!--style="border-left-color:transparent;border-right-color:transparent"-->  
                                            <p:cellEditor>
                                                <f:facet name="output">  
                                                    <h:outputText value="#{deliveryOrders.dateIssued}" />  
                                                </f:facet>  
                                                <f:facet name="input">

                                                    <p:calendar value="#{deliveryOrders.dateIssued}" pattern="dd/MM/yyyy" />
                                                </f:facet>
                                            </p:cellEditor>
                                        </p:column>   
                                        <!--DATE ISSUED-->
                                        <p:column headerText="Date Due" sortBy="#{deliveryOrders.dueDate}" 
                                                  filterBy="#{deliveryOrders.dueDate}" filterMatchMode="contains">
                                            <!--style="border-left-color:transparent;border-right-color:transparent"-->  
                                            <p:cellEditor>
                                                <f:facet name="output">  
                                                    <h:outputText value="#{deliveryOrders.dueDate}" />  
                                                </f:facet>  
                                                <f:facet name="input">

                                                    <p:calendar value="#{deliveryOrders.dueDate}" pattern="dd/MM/yyyy" />
                                                </f:facet>
                                            </p:cellEditor>
                                        </p:column>   



                                        <!--CLIENT NAME-->
                                        <p:column headerText="Client Name" sortBy="#{deliveryOrders.clientName}" 
                                                  filterBy="#{deliveryOrders.clientName}" filterMatchMode="contains">
                                            <!--style="border-left-color:transparent;border-right-color:transparent"-->
                                            <h:outputText value="#{deliveryOrders.clientName}"/>
                                        </p:column>

                                        <!--STATUS-->
                                        <p:column headerText="Status" sortBy="#{deliveryOrders.status}" 
                                                  filterBy="#{deliveryOrders.status}" filterMatchMode="contains">
                                            <!-- style="border-left-color:transparent;border-right-color:transparent"-->
                                            <p:cellEditor>
                                                <f:facet name="output">
                                                    <h:outputText value="#{deliveryOrders.status}"/>
                                                </f:facet>
                                                <f:facet name="input">            
                                                    <h:selectOneMenu value="#{deliveryOrders.status}">
                                                        <f:selectItem itemLabel="In Progress" itemValue="In Progress"/> 
                                                        <f:selectItem itemLabel="Picked" itemValue="Picked"/>

                                                        <f:selectItem itemLabel="Shipped" itemValue="Shipped"/>
                                                        <f:selectItem itemLabel="Voided" itemValue="Voided"/>                                  

                                                    </h:selectOneMenu>
                                                </f:facet>
                                            </p:cellEditor>
                                        </p:column>

                       

                                        <p:column headerText="Sales Order ID" sortBy="#{deliveryOrders.salesOrderId}" 
                                                  filterBy="#{deliveryOrders.salesOrderId}" filterMatchMode="contains"
                                                  filterStyle="width:50px"> 
                                            <!--style="border-left-color:transparent;border-right-color:transparent">-->                                     
                                            <h:outputText value="#{deliveryOrders.salesOrderId}" />   
                                        </p:column>   

                                        <p:column style="width:20px">  
                                            <p:commandLink update="display1" oncomplete="doDialog.show()" title="Edit Details">
                                                <p:graphicImage value="box.png" style="width:20px;height:20px"/>
                                                <f:setPropertyActionListener value="#{deliveryOrders}" target="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder}" />  
                                                <f:setPropertyActionListener value="#{true}" target="#{DeliveryOrderManagedBean.editMode}" />  
                                            </p:commandLink>                                                                
                                        </p:column>

                                        <p:column style="width:20px">  
                                            <p:commandButton  image="ui-icon ui-icon-check" update="executeDOPanel" oncomplete="executeDialog.show()" title="Execute Delivery Order">

                                                <f:setPropertyActionListener value="#{deliveryOrders}" target="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder}" />  

                                            </p:commandButton>                                                                
                                        </p:column>


                                        <p:rowExpansion>  
                                            <h:panelGrid id="display" columns="3" cellpadding="3"
                                                         style="font-family:Tahoma; font-size:10px;border-color:transparent;column-rule-style:hidden">

                                                <h:outputText value="Sales Order Id" />  
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.id}" />

                                                <h:outputText value="Date Issued" />  
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.dateIssued}" />  

                                                <h:outputText value="Client Id" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.clientId}" /> 

                                                <h:outputText value="Client Name" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.clientName}" />

                                                <h:outputText value="Contact Id" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.contactId}" /> 

                                                <h:outputText value="Contact Name" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.contactName}" />


                                                <h:outputText value="Shipping Address" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.shippingStreet}" />

                                                <h:outputText value="Billing Address" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.billingStreet}" />

                                                <h:outputText value="Status" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.status}" />


                                                <h:outputText value="Description" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.description}" />

                                           
                                                <h:outputText value="Sales Order ID" />
                                                <h:outputText value=":"/>
                                                <h:outputText value="#{deliveryOrders.salesOrderId}" />

                                            </h:panelGrid>  
                                        </p:rowExpansion> 
                                    </p:dataTable>  


                                    <p:ajaxStatus style="width:16px;height:16px;">  
                                        <f:facet name="start">  
                                            <h:graphicImage value="25(2).gif" />  
                                        </f:facet>  

                                        <f:facet name="complete">  
                                            <h:outputText value="" />  
                                        </f:facet>  
                                    </p:ajaxStatus> 

                                    <p:dialog header="Delivery Order Detail" widgetVar="doDialog" resizable="true"  
                                              width="900" >  
                                        <center>
                                            <p:panel id="display1" style="font-family:Tahoma;font-size:11px" >  

                                                <table cellspacing="3" cellpadding="3" width="100%">
                                                    <tr>
                                                        <td><h:outputText value="ID" style="font-weight:bold"/></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.id}" /> </td> 

                                                        <td><h:outputText value="Delivery Order Name" style="font-weight:bold"/> </td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.documentName}"
                                                                              style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.documentName}" 
                                                                             rendered="#{DeliveryOrderManagedBean.editMode}" required="true"/>
                                                            </h:panelGroup></td>
                                                    </tr>

                                                    <tr>
                                                        <td><h:outputText value="Date Issued" style="font-weight:bold"/></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.dateIssued}"/></td>

                                                        <td><h:outputText value="Date Due" style="font-weight:bold"/></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.dueDate}"
                                                                              style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>
                                                                <p:calendar value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.dueDate}"
                                                                            rendered="#{DeliveryOrderManagedBean.editMode}" required="true"/>
                                                            </h:panelGroup></td>
                                                    </tr>

                                                    <tr>
                                                        <td><h:outputText value="Client ID" style="font-weight:bold"/> </td>
                                                        <td><h:outputText value=":"/>    </td>                              
                                                        <td><h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.clientId}" /></td>  

                                                        <td><h:outputText value="Client Name" style="font-weight:bold"/></td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.clientName}" /> </td> 
                                                    </tr>

                                                    <tr>
                                                        <td> <h:outputText value="Contact ID - Name" style="font-weight:bold"/></td> 
                                                        <td> <h:outputText value=":"/> </td>                                 
                                                        <td> <h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.contactId} - #{DeliveryOrderManagedBean.selectedViewDeliveryOrder.contactName}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <h:selectOneMenu value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.contactId}"
                                                                                 rendered="#{DeliveryOrderManagedBean.editMode}">  

                                                                    <f:selectItem itemLabel="Select Contact [ID - Name]" itemValue=""/>
                                                                    <f:selectItems value="#{DeliveryOrderManagedBean.selectedContactList}" var="contacts"
                                                                                   itemLabel ="#{contacts.id} - #{contacts.firstName} #{contacts.lastName}" itemValue="#{contacts.id}"/>    
                                                                </h:selectOneMenu>

                                                            </h:panelGroup></td></tr>

                                                    <tr>
                                                        <td><h:outputText value="Shipping Street" style="font-weight:bold"/></td> 
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingStreet}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingStreet}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup>  </td>

                                                        <td><h:outputText value="Billing Street" style="font-weight:bold"/> </td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingStreet}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingStreet}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup></td></tr>

                                                    <tr>
                                                        <td><h:outputText value="Shipping State" style="font-weight:bold"/></td> 
                                                        <td><h:outputText value=":"/></td>
                                                        <td> <h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingState}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingState}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup></td>  

                                                        <td> <h:outputText value="Billing State" style="font-weight:bold"/> </td>
                                                        <td> <h:outputText value=":"/></td>
                                                        <td> <h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingState}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingState}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup></td></tr>

                                                    <tr>
                                                        <td> <h:outputText value="Shipping City" style="font-weight:bold"/></td> 
                                                        <td> <h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingCity}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingCity}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup> </td> 

                                                        <td> <h:outputText value="Billing City" style="font-weight:bold"/></td> 
                                                        <td><h:outputText value=":"/></td>
                                                        <td> <h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingCity}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingCity}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup></td></tr>

                                                    <tr>
                                                        <td> <h:outputText value="Shipping Code" style="font-weight:bold"/></td> 
                                                        <td><h:outputText value=":"/></td>
                                                        <td> <h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingCode}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingCode}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup> </td> 

                                                        <td><h:outputText value="Billing Code" style="font-weight:bold"/> </td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingCode}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingCode}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup></td>  </tr>

                                                    <tr>
                                                        <td><h:outputText value="Shipping Country" style="font-weight:bold"/></td> 
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingCountry}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingCountry}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup> </td> 

                                                        <td><h:outputText value="Billing Country" style="font-weight:bold"/> </td>
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingCountry}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.billingCountry}" rendered="#{DeliveryOrderManagedBean.editMode}" required="true" label="Company Name"/>  
                                                            </h:panelGroup> </td></tr>

                                                    <tr>
                                                        <td><h:outputText value="Shipping Method" style="font-weight:bold"/></td> 
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingMethod}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <h:selectOneMenu value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingMethod}"
                                                                                 rendered="#{DeliveryOrderManagedBean.editMode}">
                                                                    <f:selectItem itemLabel="Land" itemValue="Land"/>
                                                                    <f:selectItem itemLabel="Air" itemValue="Air"/>
                                                                    <f:selectItem itemLabel="Sea" itemValue="Sea"/>

                                                                </h:selectOneMenu> 
                                                            </h:panelGroup></td>

                                                        <td><h:outputText value="Shipping Rule" style="font-weight:bold"/></td> 
                                                        <td><h:outputText value=":"/></td>
                                                        <td><h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingRule}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <h:selectOneMenu value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.shippingRule}"
                                                                                 rendered="#{DeliveryOrderManagedBean.editMode}">  
                                                                    <f:selectItem itemLabel="Availability" itemValue="Availability"/>
                                                                    <!-- <f:selectItem itemLabel="Complete Line" itemValue="Complete Line"/>
                                                                     <f:selectItem itemLabel="After Receipt" itemValue="After Receipt"/>-->
                                                                </h:selectOneMenu>
                                                            </h:panelGroup></td></tr>

                                                    <tr>
                                                        <td><h:outputText value="Freight Cost Rule" style="font-weight:bold"/></td> 
                                                        <td> <h:outputText value=":"/> </td>
                                                        <td><h:outputText value="Freight Cost Included."/></td>



                                                        <td> <h:outputText value="Payment Method" style="font-weight:bold"/></td> 
                                                        <td> <h:outputText value=":"/></td>
                                                        <td> <h:panelGroup>  
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.paymentMethod}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>  
                                                                <h:selectOneMenu  value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.paymentMethod}" 
                                                                                  rendered="#{DeliveryOrderManagedBean.editMode}" >
                                                                    <f:selectItem itemValue="On Credit" itemLabel="On Credit"/>   
                                                                    <!--<f:selectItem itemValue="Credit Card" itemLabel="Credit Card"/>-->
                                                                    <f:selectItem itemValue="Cash" itemLabel="Cash"/>
                                                                    <!--<f:selectItem itemValue="Check" itemLabel="Check"/>-->
                                                                </h:selectOneMenu>
                                                            </h:panelGroup></td> </tr> 

                                                    <tr>
                                                        <td><h:outputText value="Status" style="font-weight:bold"/></td>
                                                        <td> <h:outputText value=":"/></td>
                                                        <td> <h:panelGroup>
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.status}" style="font-weight:bold" rendered="#{!DeliveryOrderManagedBean.editMode}"/>
                                                                <h:selectOneMenu  value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.status}" rendered="#{DeliveryOrderManagedBean.editMode}">
                                                                    <f:selectItem itemLabel="In Progress" itemValue="In Progress"/> 
                                                                    <f:selectItem itemLabel="Shipped" itemValue="Shipped"/> 
                                                                    <f:selectItem itemLabel="Picked" itemValue="Picked"/>
                                                                    <f:selectItem itemLabel="Voided" itemValue="Voided"/>
                                                                </h:selectOneMenu>
                                                            </h:panelGroup></td>


                                                    </tr>

                                                    <tr>
                                                        <td>  <h:outputText value="Sales Order ID" style="font-weight:bold"/></td>
                                                        <td> <h:outputText value=":"/></td>
                                                        <td> <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.salesOrderId}"/></td>


                                                        <td><h:outputText value="Description" style="font-weight:bold"/></td>
                                                        <td> <h:outputText value=":"/></td>
                                                        <td> <h:panelGroup>
                                                                <h:outputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.description}"
                                                                              rendered="#{!DeliveryOrderManagedBean.editMode}"/>
                                                                <p:inputText value="#{DeliveryOrderManagedBean.selectedViewDeliveryOrder.description}"
                                                                             rendered="#{DeliveryOrderManagedBean.editMode}"/>
                                                            </h:panelGroup></td></tr>


                                                    <tr><td colspan="6">
                                                            <p:dataTable id="childPanel" value="#{DeliveryOrderManagedBean.selectedProductList}"
                                                                         rowEditListener="#{DeliveryOrderManagedBean.onEditLineEntry}"
                                                                         var="lineEntry" style="width:150px"  >
                                                                <p:column headerText="Product ID">
                                                                    <h:outputText value ="#{lineEntry.itemId}"/>
                                                                </p:column>

                                                                <p:column headerText="Product Name">
                                                                    <h:outputText value="#{lineEntry.itemName}"/>
                                                                </p:column>

                                                                <p:column headerText="Quantity">
                                                                    <h:outputText value="#{lineEntry.quantity}"/>
                                                                </p:column>



                                                                <p:column headerText="Price">
                                                                    <h:outputText value="#{lineEntry.price}"/>
                                                                </p:column>

                                                                <p:column headerText="Total Price">
                                                                    <h:outputText value="#{lineEntry.totalPrice}"/>
                                                                </p:column>


                                                                <p:column headerText="Amount Shipped">
                                                                    <p:cellEditor>
                                                                        <f:facet name="output">
                                                                            <h:outputText value="#{lineEntry.amountShipped}"/>
                                                                        </f:facet>
                                                                        <f:facet name="input">
                                                                            <p:inputText value="#{lineEntry.amountShipped}" style="width:100%"/>
                                                                        </f:facet>
                                                                    </p:cellEditor>
                                                                </p:column>



                                                                <p:column style="width:20px; border-left-style: transparent">    
                                                                    <p:rowEditor/>
                                                                </p:column>

                                                            </p:dataTable></td></tr>

                                                </table>
                                                <p:outputPanel rendered="#{DeliveryOrderManagedBean.editMode}" layout="block" style="text-align:right">  
                                                    <p:commandButton value="Save" update="panel" actionListener="#{DeliveryOrderManagedBean.save}"   
                                                                     oncomplete="doDialog.hide()" image="ui-icon ui-icon-check" />  
                                                    <p:commandButton value="Cancel" onclick="doDialog.hide()" type="button" image="ui-icon ui-icon-close"/>  
                                                </p:outputPanel> 

                                            </p:panel>  
                                        </center>
                                    </p:dialog>

                                    <p:dialog width="500" header="Execute Delivery Order" widgetVar="executeDialog">
                                        <h:panelGrid id="executeDOPanel" columns="3" style="font-family:Tahoma;font-size:12px">
                                            <h:outputText value="Shipping Company"/>
                                            <h:outputText value=":"/>
                                            <h:selectOneMenu value="#{DeliveryOrderManagedBean.shippingCompany}">
                                                <f:selectItem itemValue="Pacific International Lines" itemLabel="Pacific International Lines"/>
                                                <f:selectItem itemValue="Singapore Oxygen Air Liquid" itemLabel="Singapore Oxygen Air Liquid"/>
                                                <f:selectItem itemValue="Keppel Offshore and Marine" itemLabel="Keppel Offshore and Marine"/>
                                                <f:selectItem itemValue="Svitzer Far East Pte Ltd" itemLabel="Svitzer Far East Pte Ltd"/>
                                                <f:selectItem itemValue="Austen Maritime Services Pte" itemLabel="Austen Maritime Services Pte"/>                                         
                                                <f:selectItem itemValue="Nippon Kaiji Kyokai -Singapore" itemLabel="Nippon Kaiji Kyokai -Singapore"/>
                                                <f:selectItem itemValue="Newfront Shipping Asia Ltd" itemLabel="Newfront Shipping Asia Ltd"/>
                                            </h:selectOneMenu> 

                                            <h:outputText value=""/>
                                            <h:outputText value=""/>
                                            <h:outputText value=""/>

                                            <h:outputText value=""/>
                                            <h:outputText value=""/>
                                            <h:outputText value=""/>

                                            <h:outputText value=""/>
                                            <p:commandButton value="Execute" update="msgs" ajax="true" immediate="true" oncomplete="#{executeDialog.hide()}"
                                                             actionListener="#{DeliveryOrderManagedBean.executeDeliveryOrder}"/>
                                            <p:commandButton value="Cancel" onclick="executeDialog.hide()"/>
                                        </h:panelGrid>

                                    </p:dialog>
                                    <!--DIALOG FOR DELETING A  SINGLE ROW-->
                                    <p:confirmDialog message="Are you sure you want to delete this delivery order?"  
                                                     showEffect="blind" modal="true" hideEffect="blind"  
                                                     header="Delete Sales Order" severity="alert" widgetVar="customerdialog">  
                                        <center>
                                            <p:commandButton value="Yes" update="panel" ajax="true" immediate="true" oncomplete="customerdialog.hide()"  
                                                             actionListener="#{DeliveryOrderManagedBean.delete}" />  
                                            <p:commandButton value="No" onclick="customerdialog.hide()" type="button" />   
                                        </center>

                                    </p:confirmDialog>  


                                    <!--DIALOG FOR DELETING MULTIPLE ROW OF DELIVERY ORDERS-->
                                    <p:dialog header="Delete Selected Records" modal="true" widgetVar="deleteDialog">

                                        <h:outputText value="You are about to permanently delete records." /><br /><br />
                                        <h:outputText value="Are you sure you want to continue?" /><br /><br/>

                                        <center>
                                            <p:commandButton value="Yes" ajax="true" immediate="true" update="panel" 
                                                             oncomplete="deleteDialog.hide()" actionListener="#{DeliveryOrderManagedBean.deleteDeliveryOrders}" />
                                            <p:commandButton value="No" oncomplete="deleteDialog.hide()" action="#{DeliveryOrderManagedBean.cancelDelete()}" /> 

                                        </center>
                                    </p:dialog>


                                </td>
                            </tr>
                        </table>

                    </div>
                    <div id="bottom" class="bottom">
                        <h:graphicImage value="/image/merlionfooter.jpg"/>
                    </div>
                </h:form>
            </h:body>
        </f:view>
    </f:view>
</html>